//Name:
//Purpose:
//Author: wjy
//Date: 2022-01-25 15:18:28
//From:

#include <stdio.h>
#include <stdlib.h>

int main(void)
{
    int days, start, temp;
    printf("Enter number of days in month: ");
    scanf("%d", &days);
    printf("Enter starting day of the week (1=Sun, 7=Sat): ");
    scanf("%d", &start);
    temp = 7 - start + 1;
    for (int i = 1; i <= days; i++)
    {
        if (i == 1)
        {
            for (int j = 0; j < start; j++)
            {
                printf("  ");
            }
        }
        if (i < 10)
        {
            printf(" %d ", i);
        }
        else
        {
            printf("%d ", i);
        }

        if (i % 7 == temp)
        {
            printf("\n");
        }
    }
    printf("\n");
    system("pause");
    return 0;
}